package com.huawei.appgallery.forum.user.usercenter.fragment;

import android.os.Bundle;
import android.text.TextUtils;
import com.huawei.appgallery.forum.base.https.jgw.JGWTabDetailResponse;
import com.huawei.appgallery.forum.base.ui.JGWTabFragment;
import com.huawei.appgallery.forum.cards.bean.ForumPostCardBean;
import com.huawei.appgallery.forum.user.api.IUserHomePageProtocol;
import com.huawei.appgallery.foundation.ui.framework.cardframe.bean.BaseDetailResponse.LayoutData;
import com.huawei.appgallery.foundation.ui.framework.cardframe.fragment.TaskFragment;
import com.huawei.appgallery.foundation.ui.framework.cardframe.fragment.TaskFragment.b;
import com.huawei.appgallery.foundation.ui.framework.widget.NodataWarnLayout.e;
import com.huawei.hmf.annotation.FragmentDefine;
import com.huawei.hms.support.hianalytics.HiAnalyticsConstant;
import java.util.List;
import o.bqv;
import o.bsl;
import o.bsv;
import o.cbb.a;
import o.cbb.j;

@FragmentDefine(alias = "UserHomeTabFragment", protocol = IUserHomePageProtocol.class)
public class UserHomeTabFragment extends JGWTabFragment {
    public void ˏ(Bundle bundle) {
        IUserHomePageProtocol iUserHomePageProtocol = (IUserHomePageProtocol) this.ﹳ.ॱ();
        bqv ॱ = bsv.ॱ(iUserHomePageProtocol.getDomainId());
        ॱˊ(iUserHomePageProtocol.getUri());
        this.ʼ = new bsl(this, "", iUserHomePageProtocol.getUri(), ॱ);
        ˏ(iUserHomePageProtocol);
        super.ˏ(bundle);
    }

    private void ˏ(IUserHomePageProtocol iUserHomePageProtocol) {
        if (TextUtils.isEmpty(iUserHomePageProtocol.getUri())) {
            this.ʼᐝ = iUserHomePageProtocol.toString().hashCode();
        } else {
            this.ʼᐝ = iUserHomePageProtocol.getUri().hashCode();
        }
    }

    public void ͺˏ() {
        if (this.ߴ != null) {
            this.ߴ.setWarnImage(י());
            this.ߴ.setWarnTextOne(ՙ());
            this.ߴ.setViewVisible(e.WARN_BTN, 8);
            this.ߴ.setViewVisible(e.WARN_TEXTTWO, 8);
        }
    }

    private void ॱˊ(String str) {
        String ˋॱ = ˋॱ(str);
        Object obj = -1;
        switch (ˋॱ.hashCode()) {
            case -1753840303:
                if (ˋॱ.equals("forum|user_detail_favorite")) {
                    obj = 2;
                    break;
                }
                break;
            case 371832218:
                if (ˋॱ.equals("forum|user_detail_topic")) {
                    obj = null;
                    break;
                }
                break;
            case 566064853:
                if (ˋॱ.equals("forum|user_detail_post")) {
                    obj = 1;
                    break;
                }
                break;
        }
        switch (obj) {
            case null:
                ʻ(a.ʽ);
                ʼ(j.ʽॱ);
                return;
            case 1:
                ʻ(a.ᐝ);
                ʼ(j.ʼॱ);
                return;
            case 2:
                ʻ(a.ʻ);
                ʼ(j.ॱˋ);
                return;
            default:
                return;
        }
    }

    private String ˋॱ(String str) {
        String str2 = "";
        if (TextUtils.isEmpty(str)) {
            return str2;
        }
        if (str.split("\\|").length <= 2) {
            return str;
        }
        return str.substring(0, str.lastIndexOf(HiAnalyticsConstant.REPORT_VAL_SEPARATOR));
    }

    public boolean ˊ(TaskFragment taskFragment, b bVar) {
        if (bVar.ˋ.getResponseCode() == 0 && bVar.ˋ.getRtnCode_() == 0 && (bVar.ˋ instanceof JGWTabDetailResponse)) {
            List<LayoutData> ᐝॱ = ((JGWTabDetailResponse) bVar.ˋ).ᐝॱ();
            if (ᐝॱ != null && ᐝॱ.size() > 0) {
                for (LayoutData layoutData : ᐝॱ) {
                    if ("forumpostcard".equals(layoutData.ˏ()) && layoutData.ˋ().size() != 0) {
                        for (ForumPostCardBean ˏ : layoutData.ˋ()) {
                            ˏ.ˏ(1);
                        }
                    }
                }
            }
        }
        return super.ˊ(taskFragment, bVar);
    }
}
